import { BaseWindow } from "../../../../component/window/BaseWindow";
import { PlayerMiniInfo } from "../../../model/PlayerMiniInfo";
import { ChatHintIcon } from "./ChatHintIcon";
import { Language } from "../../../../../extend/language/Language";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { GButton } from "../../../../../com/mui/controls/GButton";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ChatPrivatePanel } from "./ChatPrivatePanel";
import { GScrollPane } from "../../../../../com/mui/controls/GScrollPane";
import { ScrollPolicy } from "../../../../../fl/controls/ScrollPolicy";
import { ObjCreate } from "../../common/ObjCreate";
import { GBox } from "../../../../../com/mui/containers/GBox";
import { GBoxDirection } from "../../../../../com/mui/containers/globalVariable/GBoxDirection";
import { ColorSelector } from "../selectPanel/ColorSelector";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { GTextInput } from "../../../../../com/mui/controls/GTextInput";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { FacePanel } from "../selectPanel/FacePanel";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { FriendStyle } from "../../friends/FriendStyle";
import { TimeButton } from "../../common/button/TimeButton";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { Global } from "../../../../../com/gengine/global/Global";
import { KeyCode } from "../../../../../com/gengine/keyBoard/KeyCode";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { ResManager } from "../../../../common/ResManager";
import { PlayerOpMenuConst } from "../../common/menu/PlayerOpMenuConst";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { ChatItemData } from "../chatViewData/ChatItemData";
import { ChatMessageWorking } from "../chatViewData/ChatMessageWorking";
import { ChatArea } from "../ChatArea";
import { ChatCellData } from "../chatViewData/ChatCellData";
import { ChatItem } from "../chatPanel/ChatItem";
import { SEntityId } from "../../../../../Message/Public/SEntityId";
import { AvatarInfo } from "../../../resource/info/AvatarInfo";
import { AvatarType } from "../../../resource/info/AvatarType";
import { ImageInfo } from "../../../../../com/gengine/resource/info/ImageInfo";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
import { BitmapTooltip } from "../../common/tooltip/BitmapTooltip";
import { PlayerOpRegister } from "../../common/menu/PlayerOpRegister";
import { Cache } from "../../../cache/Cache";
import { TextAlign } from "../../../../../flashx/textLayout/formats/TextAlign";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
import { _playerInfo } from "../../../../../this/_playerInfo";
import { _color } from "../../../../../this/_color";
type int = number;
//class ChatWindow
    
    export  class ChatWindow extends BaseWindow
    {
        constructor(arg1: PlayerMiniInfo)
        {
            super();
            this._playerInfo = arg1;
            this._icon = new ChatHintIcon(arg1);
            this.init();
            return;
        }

        /* internal  */create(): void
        {
            var loc1=null;
            loc1 = new Object /* flash.display.Sprite */();
            this._textTitle = new Object /* flash.text.TextField */();
            this._textTitle.width = 460;
            this._textTitle.text = Language.getStringByParam(40623, this._playerInfo.playerName);
            this._textTitle.selectable = false;
            this._textTitle.filters = [FilterConst.nameGlowFilter];
            this._textTitle.defaultTextFormat = tfTitle;
            loc1.addChild(this._textTitle);
            this.title = loc1;
            this._textTitle.setTextFormat(tfTitle);
            this._textTitle.y = 5;
            this._btnMinimize1 = new GButton();
            this._btnMinimize1.styleName = "MinimizeButton";
            this._btnMinimize1.setSize(19, 19);
            this._btnMinimize1.x = 407;
            this._btnMinimize1.y = 8;
            this._btnMinimize1.label = "";
            addChild(this._btnMinimize1);
            this._contentBitmap = ResouceConst.getScaleBitmap("WindowCenterB");
            this._contentBitmap.x = 18;
            this._contentBitmap.y = 42;
            this._contentBitmap.setSize(314, 198);
            this.addChild(this._contentBitmap);
            this._chatBox = new ChatPrivatePanel(40);
            this._chatBox.x = 23;
            this._chatBox.y = 34;
            this.addChild(this._chatBox);
            this._scrollPane = new GScrollPane();
            this._scrollPane.x = 20;
            this._scrollPane.y = 44;
            this._scrollPane.width = 312;
            this._scrollPane.height = 195;
            this._scrollPane.styleName = "GScrollPane";
            this._scrollPane.verticalScrollPolicy = ScrollPolicy.AUTO;
            this._scrollPane.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._scrollPane.source = this._chatBox;
            this.addChild(this._scrollPane);
            this._scrollPane.update();
            this._spMiddle = new Object /* flash.display.Sprite */();
            ObjCreate.setObjAttri(this._spMiddle, 22, 240, -1, -1, this);
            this._btnFace = ObjCreate.createGButton("", 0, 3, 18, 17, this._spMiddle, "ExpressionChatButton");
            this._areaFuns = new GBox();
            this._areaFuns.x = 21;
            this._areaFuns.direction = GBoxDirection.HORIZONTAL;
            this._spMiddle.addChild(this._areaFuns);
            this._btnColorSelector = ObjCreate.createGButton("", 0, 0, 25, 23, this._areaFuns, "ColorSelector");
            this._btnBrush = ObjCreate.createGButton("", 0, 0, 25, 23, this._areaFuns, "Brush");
            this._btnFace.toolTipData = "<font color=\'#ffffff\'>" + Language.getString(40609) + "</font>";
            this._btnColorSelector.toolTipData = "<font color=\'#ffffff\'>" + Language.getString(40610) + "</font>";
            this._btnBrush.toolTipData = "<font color=\'#ffffff\'>" + Language.getString(40613) + "</font>";
            this._colorSelector = new ColorSelector();
            this._colorSelector.x = 34;
            this._colorSelector.y = 120;
            this._tfTips = ObjCreate.createTextField(Language.getString(40679), 75, 4, 300, 20, this._spMiddle, GlobalStyle.textFormatRed);
            this._inputText = new GTextInput();
            this._inputText.x = 18;
            this._inputText.y = 268;
            this._inputText.setSize(314, 100);
            this._inputText.styleName = "GTextInput";
            this._inputText.maxChars = 50;
            this._inputText.mouseFocusEnabled = false;
            this._inputText.textField.wordWrap = true;
            this.addChild(this._inputText);
            this._inputText.drawNow();
            var loc2=new GTextFormat(FontUtil.songtiName, 12, 11661311);
            loc2.leading = 3;
            loc2.align = flash.text.TextFormatAlign.LEFT;
            this._inputText.setStyle("textPadding", 5);
            this._inputText.setStyle("textFormat", loc2);
            this.createBottom();
            this.createRightPart();
            this._facePanel = new FacePanel();
            this._facePanel.x = 20;
            this._facePanel.y = 55;
            this.addChild(this._facePanel);
            this._facePanel.visible = false;
            return;
        }

        /* internal  */setInputTextFormat(): void
        {
            var loc1=new GTextFormat(FontUtil.songtiName, 12, this._color);
            loc1.leading = 3;
            this._inputText.setStyle("textFormat", loc1);
            this._inputText.setStyle("textPadding", 5);
            return;
        }

        /* internal  */init(): void
        {
            this.setSize(460, 410);
            this.titleHeight = 30;
            this.create();
            this.updateGroupBtn();
            this.addEventListeners();
            return;
        }

        public updatePlayerMsg(arg1: PlayerMiniInfo): void
        {
            this._playerInfo = arg1;
            this._textTitle.text = Language.getStringByParam(40623, this._playerInfo.playerName);
            this._textTitle.setTextFormat(tfTitle);
            var loc1=EntityUtil.getProxyName(arg1.entityId);
            this._textPlayerMsg.htmlText = "<textformat leading=\'6\'>" + HTMLUtil.addColor(loc1, FriendStyle.color2) + "\r" + HTMLUtil.addColor(this._playerInfo.playerName, FriendStyle.color2) + "\r" + HTMLUtil.addColor(Language.getString(40627), FriendStyle.color2) + HTMLUtil.addColor(this._playerInfo.campName, FriendStyle.color1) + "\r" + HTMLUtil.addColor(Language.getString(40628), FriendStyle.color2) + HTMLUtil.addColor(this._playerInfo.careerEnableName, FriendStyle.color1) + "\r" + HTMLUtil.addColor(Language.getString(40629), FriendStyle.color2) + HTMLUtil.addColor(this._playerInfo.level.toString(), FriendStyle.color1) + "\r" + "</textformat>";
            this.icon.refresh(arg1);
            this.updateInfo();
            return;
        }

        /* internal  */createBottom(): void
        {
            this._btnTips = new Object /* flash.text.TextField */();
            this._btnTips.defaultTextFormat = FriendStyle.textFormat1;
            this._btnTips.text = Language.getString(40624);
            this._btnTips.filters = [FilterConst.nameGlowFilter];
            this._btnTips.x = 23;
            this._btnTips.y = 375;
            this._btnTips.height = 20;
            this._btnTips.width = 100;
            this.addChild(this._btnTips);
            this._btnClose = new GButton();
            this._btnClose.width = 47;
            this._btnClose.height = 22;
            this._btnClose.styleName = "Button";
            this._btnClose.x = 237;
            this._btnClose.label = Language.getString(40625);
            this._btnClose.y = 373;
            this._btnClose.textField.filters = [FilterConst.nameGlowFilter];
            this.addChild(this._btnClose);
            this._btnSend = new TimeButton(3, false);
            this._btnSend.width = 47;
            this._btnSend.height = 22;
            this._btnSend.styleName = "Button";
            this._btnSend.x = 285;
            this._btnSend.label = Language.getString(40626);
            this._btnSend.y = 373;
            this._btnSend.textField.filters = [FilterConst.nameGlowFilter];
            this.addChild(this._btnSend);
            return;
        }

        /* internal  */createRightPart(): void
        {
            var loc1=null;
            this._rightSprite = new Object /* flash.display.Sprite */();
            this._rightSprite.x = 335;
            this._rightSprite.y = 42;
            this.addChild(this._rightSprite);
            loc1 = ResouceConst.getScaleBitmap("WindowCenterB");
            loc1.x = 0;
            loc1.y = 0;
            loc1.setSize(106, 353);
            this._rightSprite.addChild(loc1);
            this._headBg = new Object /* flash.display.Bitmap */();
            this._headBg.x = 4;
            this._headBg.y = 4;
            this._rightSprite.addChild(this._headBg);
            LoaderHelp.setBitmapdata("Friend_Bg_Head.swf", this._headBg);
            this._headImageContainer = new Object /* flash.display.Sprite */();
            this._headImageContainer.buttonMode = true;
            this._headImageContainer.x = 21;
            this._headImageContainer.y = 21;
            this._rightSprite.addChild(this._headImageContainer);
            this._headImage = new Object /* flash.display.Bitmap */();
            this._headImageContainer.addChild(this._headImage);
            this._uploadImageContainer = new Object /* flash.display.Sprite */();
            this._uploadImageContainer.x = 4;
            this._uploadImageContainer.y = 4;
            this._uploadImageContainer.visible = false;
            this._uploadImageContainer.buttonMode = true;
            this._rightSprite.addChild(this._uploadImageContainer);
            ObjCreate.createBg(0, 0, 99, 99, this._uploadImageContainer, "ToolTipBg");
            this._upLoadImage = new Object /* flash.display.Bitmap */();
            this._upLoadImage.x = 2;
            this._upLoadImage.y = 2;
            this._uploadImageContainer.addChild(this._upLoadImage);
            var loc2=EntityUtil.getProxyName(this._playerInfo.entityId);
            this._textPlayerMsg = new Object /* flash.text.TextField */();
            this._textPlayerMsg.x = 4;
            this._textPlayerMsg.y = 100;
            this._textPlayerMsg.height = 106;
            this._textPlayerMsg.filters = [FilterConst.nameGlowFilter];
            this._textPlayerMsg.htmlText = "<textformat leading=\'6\'>" + HTMLUtil.addColor(loc2, FriendStyle.color2) + "\r" + HTMLUtil.addColor(this._playerInfo.playerName, FriendStyle.color2) + "\r" + HTMLUtil.addColor(Language.getString(40627), FriendStyle.color2) + HTMLUtil.addColor(this._playerInfo.campName, FriendStyle.color1) + "\r" + HTMLUtil.addColor(Language.getString(40628), FriendStyle.color2) + HTMLUtil.addColor(this._playerInfo.careerEnableName, FriendStyle.color1) + "\r" + HTMLUtil.addColor(Language.getString(40629), FriendStyle.color2) + HTMLUtil.addColor(this._playerInfo.level.toString(), FriendStyle.color1) + "\r" + "</textformat>";
            this._rightSprite.addChild(this._textPlayerMsg);
            this._btnRequestTrade = new GButton();
            this._btnRequestTrade.x = 20;
            this._btnRequestTrade.y = 230;
            this._btnRequestTrade.width = 70;
            this._btnRequestTrade.height = 26;
            this._btnRequestTrade.styleName = "ButtonLarge";
            this._btnRequestTrade.textField.filters = [FilterConst.nameGlowFilter];
            this._btnRequestTrade.label = Language.getString(40630);
            this._rightSprite.addChild(this._btnRequestTrade);
            this._btnInviteTeam = new GButton();
            this._btnInviteTeam.x = 20;
            this._btnInviteTeam.y = 260;
            this._btnInviteTeam.width = 70;
            this._btnInviteTeam.height = 26;
            this._btnInviteTeam.styleName = "ButtonLarge";
            this._btnInviteTeam.textField.filters = [FilterConst.nameGlowFilter];
            this._btnInviteTeam.label = Language.getString(40680);
            this._rightSprite.addChild(this._btnInviteTeam);
            this._btnApplyTeam = new GButton();
            this._btnApplyTeam.x = 20;
            this._btnApplyTeam.y = 260;
            this._btnApplyTeam.width = 70;
            this._btnApplyTeam.height = 26;
            this._btnApplyTeam.styleName = "ButtonLarge";
            this._btnApplyTeam.textField.filters = [FilterConst.nameGlowFilter];
            this._btnApplyTeam.label = Language.getString(40680);
            this._rightSprite.addChild(this._btnApplyTeam);
            this._btnApplyTeam.visible = false;
            this._btnAddFriend = new GButton();
            this._btnAddFriend.x = 20;
            this._btnAddFriend.y = 290;
            this._btnAddFriend.width = 70;
            this._btnAddFriend.height = 26;
            this._btnAddFriend.styleName = "ButtonLarge";
            this._btnAddFriend.textField.filters = [FilterConst.nameGlowFilter];
            this._btnAddFriend.label = Language.getString(40632);
            this._rightSprite.addChild(this._btnAddFriend);
            this._btnLookInfo = new GButton();
            this._btnLookInfo.x = 20;
            this._btnLookInfo.y = 320;
            this._btnLookInfo.width = 70;
            this._btnLookInfo.height = 26;
            this._btnLookInfo.styleName = "ButtonLarge";
            this._btnLookInfo.textField.filters = [FilterConst.nameGlowFilter];
            this._btnLookInfo.label = Language.getString(40633);
            this._rightSprite.addChild(this._btnLookInfo);
            this._sendFlower = ObjCreate.createGButton(Language.getString(40691), 20, 235, 70, 26, this._rightSprite, "ButtonLarge");
            var loc3=GlobalStyle.textFormatGreen;
            loc3.leading = 7;
            this._tfCrossTip = ObjCreate.createTextField("", 10, 270, 90, 100, this._rightSprite, loc3);
            this._tfCrossTip.multiline = true;
            this._tfCrossTip.wordWrap = true;
            this._tfCrossTip.text = Language.getString(40692);
            this.updateInfo();
            return;
        }

        /* internal  */addEventListeners(): void
        {
            this._inputText.addEventListener(flash.events.KeyboardEvent.KEY_DOWN, this.keyHandler);
            this._btnSend.addEventListener(flash.events.MouseEvent.CLICK, this.sendHandler);
            this._btnClose.addEventListener(flash.events.MouseEvent.CLICK, this.closeHandler);
            this._btnAddFriend.addEventListener(flash.events.MouseEvent.CLICK, this.addFriendHandler);
            this._btnMinimize1.addEventListener(flash.events.MouseEvent.CLICK, this.minimizehandler);
            this._btnLookInfo.addEventListener(flash.events.MouseEvent.CLICK, this.lookInfohandler);
            this._btnRequestTrade.addEventListener(flash.events.MouseEvent.CLICK, this.requestTradeHandler);
            this._btnInviteTeam.addEventListener(flash.events.MouseEvent.CLICK, this.inviteTeamHandler);
            this._btnApplyTeam.addEventListener(flash.events.MouseEvent.CLICK, this.applyTeamHandler);
            this._sendFlower.addEventListener(flash.events.MouseEvent.CLICK, this.onClickSendFlower);
            this._facePanel.addCall(this.selectFace);
            this._btnFace.addEventListener(flash.events.MouseEvent.CLICK, this.showFacePanelHandler);
            this._btnColorSelector.addEventListener(flash.events.MouseEvent.CLICK, this.onColorSelector);
            this._btnBrush.addEventListener(flash.events.MouseEvent.CLICK, this.onBtnBrushClick);
            this._colorSelector.addCall(this.selectColor);
            Global.stage.addEventListener(flash.events.MouseEvent.CLICK, this.canselPanelsHandler);
            this.addEventListener(flash.events.Event.ADDED_TO_STAGE, this.onAddToStage);
            return;
        }

        /* internal  */keyHandler(arg1: Object /* flash.events.KeyboardEvent */): void
        {
            if (arg1.keyCode == KeyCode.ENTER) 
            {
                this.SendMsg();
            }
            return;
        }

        /* internal  */sendHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.SendMsg();
            return;
        }

        /* internal  */SendMsg(): void
        {
            if (this._inputText.text && this._btnSend.enabled) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ChatPrivateSend, {"content": this._inputText.text, "toPlayer": _playerInfo, "color": _color}));
                this._inputText.text = "";
                this._btnSend.trigger();
            }
            return;
        }

        /* internal  */onColorSelector(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._colorSelector.parent) 
            {
                this._colorSelector.parent.removeChild(this._colorSelector);
            }
            else 
            {
                this.addChild(this._colorSelector);
            }
            return;
        }

        /* internal  */selectColor(arg1: uint): void
        {
            if (this._colorSelector.parent) 
            {
                this._colorSelector.parent.removeChild(this._colorSelector);
            }
            this._color = arg1;
            this.setInputTextFormat();
            return;
        }

        /* internal  */onBtnBrushClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            this._chatBox.reset();
            if (!this.isHide) 
            {
                this.timeOutUpdate();
            }
            return;
        }

        /* internal  */selectFace(arg1: Object): void
        {
            this._facePanel.visible = false;
            this._inputText.appendText("/" + arg1.toString() + " ");
            this._inputText.setFocus();
            this._inputText.setSelection(this._inputText.text.length, this._inputText.text.length);
            return;
        }

        /* internal  */showFacePanelHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            ResManager.instance.LoadFace();
            this._facePanel.visible = !this._facePanel.visible;
            return;
        }

        /* internal  */canselPanelsHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.target as Object /* flash.display.DisplayObject */;
            if (!(loc1 == this._btnColorSelector) && !(loc1 == this._colorSelector) && (!loc1.parent || !(loc1.parent == this._colorSelector))) 
            {
                if (this._colorSelector.parent) 
                {
                    this._colorSelector.parent.removeChild(this._colorSelector);
                }
            }
            if (!(loc1 == this._btnFace) && !(loc1 == this._facePanel) && !this._facePanel.contains(loc1)) 
            {
                this._facePanel.visible = false;
            }
            return;
        }

        /* internal  */closeHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        /* internal  */addFriendHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            PlayerOpMenuConst.Opearte(PlayerOpMenuConst.AddFriend, this._playerInfo);
            return;
        }

        /* internal  */requestTradeHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            PlayerOpMenuConst.Opearte(PlayerOpMenuConst.Trade, this._playerInfo);
            return;
        }

        /* internal  */inviteTeamHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            PlayerOpMenuConst.Opearte(PlayerOpMenuConst.InvitedToTeam, this._playerInfo);
            return;
        }

        /* internal  */applyTeamHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            PlayerOpMenuConst.Opearte(PlayerOpMenuConst.ApplyToTeam, this._playerInfo);
            return;
        }

        /* internal  */onClickSendFlower(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FlowerOpenHandselFlower, this._playerInfo));
            return;
        }

        /* internal  */lookInfohandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            PlayerOpMenuConst.Opearte(PlayerOpMenuConst.LookInfo, this._playerInfo);
            return;
        }

        public addChatItem(arg1: string, arg2: Date, arg3: string, arg4: int=0, arg5: int=1): void
        {
            var loc1;
            (loc1 = ObjectPool.getObject(ChatItemData)).type = ChatMessageWorking.getChatTypeByAreaName(ChatArea.Secret);
            var loc2=new Vector.<ChatCellData>();
            if (arg4 == 0) 
            {
                arg4 = 16645629;
            }
            loc2 = loc2.concat(ChatMessageWorking.getCellDataByContent(arg3, arg4, true, 12, arg5));
            loc1.cellVector = loc2;
            var loc3;
            (loc3 = ObjectPool.getObject(ChatItem)).init(loc1.getContentElement(), 270, 22);
            this._chatBox.addChatItem(loc3, arg1, arg2);
            loc1.dispose();
            if (!this.isHide) 
            {
                this.timeOutUpdate();
            }
            return;
        }

        public getChatPlayerName(): string
        {
            return this._playerInfo.playerName;
        }

        public getChatPlayerEntityId(): SEntityId
        {
            return this._playerInfo.entityId;
        }

        public getChatPlayerInfo(): PlayerMiniInfo
        {
            return this._playerInfo;
        }

        public ChatWindow.get icon(): ChatHintIcon
        {
            return this._icon;
        }

        public minimizehandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.visible = false;
            return;
        }

        public ChatWindow.get inputText(): GTextInput
        {
            return this._inputText;
        }

        /* internal  */updateInfo(): void
        {
            var isCross: Boolean;
            var isHavePhoto: Boolean;

            var loc1;
            isCross = !EntityUtil.isSameServerByRole(this._playerInfo.entityId);
            isHavePhoto = Boolean(this._playerInfo.photo) && !isCross;
            this._headImageContainer.visible = !isHavePhoto;
            this._headBg.visible = !isHavePhoto;
            this._uploadImageContainer.visible = isHavePhoto;
            this._btnRequestTrade.visible = !isCross;
            this._btnInviteTeam.visible = !isCross;
            this._btnApplyTeam.visible = !isCross;
            this._btnAddFriend.visible = !isCross;
            this._sendFlower.visible = isCross;
            this._tfCrossTip.visible = isCross;
            if (isCross) 
            {
                this._btnLookInfo.y = 205;
            }
            else 
            {
                this._btnLookInfo.y = 320;
            }
            if (isHavePhoto) 
            {
                AvatarInfo.getUpdateAvatar(this._playerInfo.entityId, AvatarType.UPLOADBIG, (arg1: ImageInfo): void
                {
                    _upLoadImage.bitmapData = arg1.bitmapData;
                    _upLoadImage.width = 95;
                    _upLoadImage.height = 95;
                    ToolTipsManager.register(_uploadImageContainer, BitmapTooltip, arg1.bitmapData);
                    return;
                })
                PlayerOpRegister.Register(this._uploadImageContainer, this._playerInfo, PlayerOpMenuConst.ChatPrivateOpMenu);
            }
            else 
            {
                AvatarInfo.getAvatar(this._playerInfo.camp, this._playerInfo.sex, AvatarType.BIG, (arg1: ImageInfo): void
                {
                    _headImage.bitmapData = arg1.bitmapData;
                    return;
                }, this._playerInfo.avatarId)
                PlayerOpRegister.Register(this._headImageContainer, this._playerInfo, PlayerOpMenuConst.ChatPrivateOpMenu);
            }
            return;
        }

        public updateGroupBtn(): void
        {
            var loc1=!EntityUtil.isSameServerByRole(this._playerInfo.entityId);
            if (!loc1) 
            {
                if (Cache.instance.group.isInGroup && (Cache.instance.group.isCaptain || Cache.instance.group.memberInvite)) 
                {
                    this._btnInviteTeam.visible = true;
                    this._btnApplyTeam.visible = false;
                }
                else 
                {
                    this._btnInviteTeam.visible = false;
                    this._btnApplyTeam.visible = true;
                }
            }
            return;
        }

        public /* override */ set visible(arg1: Boolean)
        {
            super.visible = arg1;
            this.updateGroupBtn();
            if (arg1) 
            {
                this.timeOutUpdate();
            }
            return;
        }

        /* internal  */onAddToStage(arg1: Object /* flash.events.Event */): void
        {
            this.reSetScrollPanePosition();
            return;
        }

        /* internal  */timeOutUpdate(): void
        {
            flash.utils.setTimeout(this.reSetScrollPanePosition, 100);
            return;
        }

        public reSetScrollPanePosition(): void
        {
            if (this._scrollPane && Global.stage.contains(this._scrollPane)) 
            {
                this._chatBox.validateNow();
                flash.utils.setTimeout(this.validatePos, 50);
            }
            return;
        }

        /* internal  */validatePos(): void
        {
            this._scrollPane.validateNow();
            this._scrollPane.update();
            this._scrollPane.verticalScrollPosition = this._scrollPane.maxVerticalScrollPosition;
            return;
        }

        /* internal  */static get tfTitle(): Object /* flash.text.TextFormat */
        {
            if (!ChatWindow._tfTitle) 
            {
                ChatWindow._tfTitle = new GTextFormat();
                ChatWindow._tfTitle.size = 14;
                ChatWindow._tfTitle.align = TextAlign.CENTER;
                ChatWindow._tfTitle.color = 15859633;
            }
            return ChatWindow._tfTitle;
        }

        /* internal */ /* var */_btnMinimize1: GButton;

        /* internal */ /* var */_titleTextFiled: Object /* flash.text.TextField */;

        /* internal */ /* var */_contentBitmap: ScaleBitmap;

        /* internal */ /* var */_scrollPane: GScrollPane;

        /* internal */ /* var */_chatBox: ChatPrivatePanel;

        /* internal */ /* var */_color: uint=16645629;

        /* internal */ /* var */_inputText: GTextInput;

        /* internal */ /* var */_upLoadImage: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_rightSprite: Object /* flash.display.Sprite */;

        /* internal */ /* var */_areaFuns: GBox;

        /* internal */ /* var */_btnFace: GButton;

        /* internal */ /* var */_btnColorSelector: GButton;

        /* internal */ /* var */_btnBrush: GButton;

        /* internal */ /* var */_colorSelector: ColorSelector;

        /* internal */ /* var */_tfTips: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnTips: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnClose: GButton;

        /* internal */ /* var */_btnSend: TimeButton;

        /* internal */ /* var */_btnRequestTrade: GButton;

        /* internal */ /* var */_btnInviteTeam: GButton;

        /* internal */ /* var */_btnApplyTeam: GButton;

        /* internal */ /* var */_btnAddFriend: GButton;

        /* internal */ /* var */_btnLookInfo: GButton;

        /* internal */ /* var */_sendFlower: GButton;

        /* internal */ /* var */_textPlayerMsg: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfCrossTip: Object /* flash.text.TextField */;

        /* internal */ /* var */_icon: ChatHintIcon;

        /* internal */ /* var */_facePanel: FacePanel;

        /* internal */ /* var */_textTitle: Object /* flash.text.TextField */;

        /* internal */ /* var */_headBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_headImageContainer: Object /* flash.display.Sprite */;

        /* internal */ /* var */_headImage: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_uploadImageContainer: Object /* flash.display.Sprite */;

        /* internal */ /* var */_spMiddle: Object /* flash.display.Sprite */;

        /* internal */ static /* var */_tfTitle: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_playerInfo: PlayerMiniInfo;
    }
